Trò chơi đua xe động vật trong UNITY Engine
114.853 lượt xem;
- BuyLayer.cs
- ShopScreen /
- AnimalRacing /
- Scripts /
- Assets /
- project /
1 using UnityEngine;
2 using System.Collections;
3
4 public class BuyLayer : MonoBehaviour {
5
6 public Label boosterLabel;
7 public Label springsLabel;
8
9 public Label starLabel;
10 public Label goldLabel;
11
12 private BitmapFont desFont;
13
14 public void Start()
15 {
16 }
17
18 public void setFont(BitmapFont fontShop)
19 {
20 starLabel.setFont(fontShop);
21 goldLabel.setFont(fontShop);
22 desFont = new BitmapFont("Fonts/bitmapfont1", "Fonts/bitmapfont1_xml", null);
23 boosterLabel.setFont(desFont);
24 springsLabel.setFont(desFont);
25 }
26
27 public void setParams(int booster, int springs, int starUnlock, int cost)
28 {
29 starLabel.setText(starUnlock + "", 0, 0);
30 goldLabel.setText(cost + "", 0, 0);
31
32 boosterLabel.gameObject.transform.localScale = new Vector3(1, 1, boosterLabel.gameObject.transform.localScale.z);
33 springsLabel.gameObject.transform.localScale = new Vector3(1, 1, springsLabel.gameObject.transform.localScale.z);
34
35 boosterLabel.setText("SPEED : " + booster, 0, 15);
36 springsLabel.setText("JUMP : " + springs, 0, 15);
37
38 boosterLabel.gameObject.transform.localScale = new Vector3(0.7f, 0.7f, boosterLabel.gameObject.transform.localScale.z);
39 springsLabel.gameObject.transform.localScale = new Vector3(0.7f, 0.7f, springsLabel.gameObject.transform.localScale.z);
40 }
41 }
2 using System.Collections;
3
4 public class BuyLayer : MonoBehaviour {
5
6 public Label boosterLabel;
7 public Label springsLabel;
8
9 public Label starLabel;
10 public Label goldLabel;
11
12 private BitmapFont desFont;
13
14 public void Start()
15 {
16 }
17
18 public void setFont(BitmapFont fontShop)
19 {
20 starLabel.setFont(fontShop);
21 goldLabel.setFont(fontShop);
22 desFont = new BitmapFont("Fonts/bitmapfont1", "Fonts/bitmapfont1_xml", null);
23 boosterLabel.setFont(desFont);
24 springsLabel.setFont(desFont);
25 }
26
27 public void setParams(int booster, int springs, int starUnlock, int cost)
28 {
29 starLabel.setText(starUnlock + "", 0, 0);
30 goldLabel.setText(cost + "", 0, 0);
31
32 boosterLabel.gameObject.transform.localScale = new Vector3(1, 1, boosterLabel.gameObject.transform.localScale.z);
33 springsLabel.gameObject.transform.localScale = new Vector3(1, 1, springsLabel.gameObject.transform.localScale.z);
34
35 boosterLabel.setText("SPEED : " + booster, 0, 15);
36 springsLabel.setText("JUMP : " + springs, 0, 15);
37
38 boosterLabel.gameObject.transform.localScale = new Vector3(0.7f, 0.7f, boosterLabel.gameObject.transform.localScale.z);
39 springsLabel.gameObject.transform.localScale = new Vector3(0.7f, 0.7f, springsLabel.gameObject.transform.localScale.z);
40 }
41 }